import asyncio
from common.exchange import get_async_binance_portfolio_exchange
from common.variables import get_datas_path
import joblib


memory = joblib.Memory(location=get_datas_path())


@memory.cache
def get_market_data():
    exchange = get_async_binance_portfolio_exchange()
    asyncio.run(exchange.load_markets())
    return exchange.markets
